package com.ad.pet.app.account.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.app.Navigation;
import com.ad.pet.models.remote.account.order.ParcelDate;
import com.ad.pet.utils.CopyUtils;

import java.util.List;

/**
 * Created by liuyixiang on 2019/9/21.
 */

public class PacketNumberAdapter extends BaseQuickAdapter<ParcelDate, BaseViewHolder> {
    public PacketNumberAdapter(@Nullable List<ParcelDate> data) {
        super(R.layout.item_packet_number_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final ParcelDate item) {
        TextView mTvCopy = helper.getView(R.id.tv_copy);
        TextView tv_look_detail = helper.getView(R.id.tv_look_detail);
        TextView tv_packet=helper.getView(R.id.tv_packet);
        tv_packet.setText(item.getTracking_number_str());
        tv_look_detail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Navigation.goCommonWebView(mContext,"",item.getShipping_query_website());
            }
        });
        final CopyUtils copyUtils = new CopyUtils(mContext,tv_packet);
        mTvCopy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                copyUtils.init();
            }
        });
    }
}
